package com.module.overview.ui.historicalDataDetails.provider

import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.common.app.data.bean.overView.HistoryDetailsModel
import com.common.base.app.extras.yes
import com.module.ble.db.table.UserSportRecord
import com.module.ble.utils.AllCardTypeConfig
import com.module.overview.R
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityRecordItemAdapter
import java.util.Random

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/08/11
 *
 * 描述：历史活动运动记录卡片
 *
 * 修订历史：
 *
 */
class OvHdActivitySportsRecordCardProvider(
    val mType: Int = 1,
    override val itemViewType: Int = AllCardTypeConfig.TYPE_CARD_HD_ACTIVITY_PORTS_RECORD,
    override val layoutId: Int = R.layout.overview_hd_activity_sports_record_crad_provider
) : BaseItemProvider<HistoryDetailsModel>() {


    private val  mAdapter by lazy { OvActivityRecordItemAdapter() }
    init {
    }

    override fun convert(helper: BaseViewHolder, item: HistoryDetailsModel) {
        helper.getView<RecyclerView>(R.id.hrvRecord).apply{
            adapter = mAdapter
        }
        val data1 = UserSportRecord()
        data1.sportType = 5
        val data2 = UserSportRecord()
        data2.sportType = 8
        val data3 = UserSportRecord()
        data3.sportType = 9
        val data4 = UserSportRecord()
        data4.sportType = 10
        val data5 = UserSportRecord()
        data5.sportType = 11

        val mList = mutableListOf<UserSportRecord>()
        Random().nextBoolean().yes { mList.add(data1) }
        Random().nextBoolean().yes { mList.add(data2) }
        Random().nextBoolean().yes { mList.add(data3) }
        Random().nextBoolean().yes { mList.add(data4) }
        Random().nextBoolean().yes { mList.add(data5) }

        mAdapter.setList(mList)

        helper.setVisible(R.id.tvNotRecordHint, mAdapter.data.isNullOrEmpty())

    }
}